const mongoose = require('mongoose');
const Schema = mongoose.Schema

mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});

var studentSchema = new Schema({
    id: {
        type: Number,
        // required: true
    },
    name: {
        type: String,
        required: true
    },
    gender: {
        type: Number,
        enum: [0,1],
        default: 0
    },
    age: {
        type: Number
    },
    hobby: {
        type: String
    }
})

module.exports = mongoose.model('Student', studentSchema)
// mongoose.connect('mongodb://localhost:27017/test', {useNewUrlParser: true, useUnifiedTopology: true});
